package com.chis.jxc;

import com.chis.jmdatatimer.comm.TxMgmtModule;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.ArrayList;
import java.util.List;

/**
 * 
 * @Description 查询mysql库中的零库存，并在HBASE中还有码库存的电子监管码库，并清空零库存的电子监管码库
 * @Company zwx
 * @author wlj
 * @version 2019年09月05日
 */
public class BalanceRmReal {
    public static void main(String[] args) throws Exception {
        String zone = args[0];
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[] {"spring.xml"});
        context.start();
        TxMgmtModule txMgmtModule = (TxMgmtModule) context.getBean("TxMgmtModule");
        List<String> list = txMgmtModule.findZeroKcByZone(zone);
        int count = 0 ;
        List<String> tmplist = new ArrayList<>();
        for(String t : list){
            tmplist.add(t);
            count++;
            if(count > 50){
                txMgmtModule.rmstmcodeRT(tmplist);
                tmplist = new ArrayList<>();
                count = 0;
            }
        }
        if(count > 0){
            txMgmtModule.rmstmcodeRT(tmplist);
        }


    }
}
